<template>
	<view class="goodsListItem">
		<view class="imgBox">
			<image :src="goods.goods_small_logo || defaultImg" mode=""></image>
		</view>
		<view class="textBox">
			<text class="goodsName">{{goods.goods_name}}</text>
			<text class="price">￥{{goods.goods_price | tofixed}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"goods",
		data() {
			return {
				defaultImg:"https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png"
			};
		},
		props:{
			goods:{
				type:Object,
				default:{}
			}
		},
		// 过滤器节点
		filters:{
			// 把数字处理为带两位小数点的数字
			tofixed(num){
				return Number(num).toFixed(2)
			}
		}
	}
</script>

<style lang="scss">
.goodsListItem{
	display: flex;
	padding: 10px 5px;
	border-bottom: 1px solid #f0f0f0;
	.imgBox{
		margin-left: 5px;
		image{
			width: 100px;
			height: 100px;
			display: block;
		}
	}
	.textBox{
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		padding: 10px;
		.goodsName{
			font-size: 13px;
		}
		.price{
			font-size: 16px;
			color: #c00000;
		}
	}
}
</style>